/*
 * @Author: your name
 * @Date: 2020-11-14 08:37:28
 * @LastEditTime: 2021-04-05 11:42:35
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \HDZP\HDY-Perfect\src\store\saga.js
 */
import { put, all, takeLatest, takeEvery} from 'redux-saga/effects'
import { getAddress } from '@api'

import {
// actionType
  GET_ADDRESS
} from './constants';


import {
  // action
  getAddressAction
  
} from './actionCreators';

function* fetchAddressData(action) {
  const res = yield getAddress();
  const data = res;

  yield all([
    yield put(getAddressAction(data))
  ])
}



function* mySaga() {

  //  takeLatest takeEvery 区别
  //  takeLatest 依次只能监听一个对应的action
  //  takeEvery  每一个都会被执行


  yield all([
    takeEvery(GET_ADDRESS, fetchAddressData ),
    // tackLatest(...) 
  ])
}

export default mySaga;